﻿@model Zor_Web.Models.Base.V_Acceptance
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>自然人管理</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 日期选择器 -->
    <script src="~/Content/laydate/laydate.js"></script>
    <!-- 表单验证 -->
    <script src="~/Content/Scripts/JValidator.js"></script>
    <!-- 税收算法 -->
    <script src="~/Content/Scripts/RatMoney.js"></script>
</head>
<body class="gray-bg">
    <div class="layui-tab layui-tab-brief main-tab-container ">

        <div class="col-sm-12 ct-padding">
            <div class="col-sm-8 ct-padding">

                <button id="btnAdd" class="layui-btn layui-btn layui-btn-small"><span class="glyphicon glyphicon-plus"></span> 新增</button>
                <button id="btnUpdate" class="layui-btn layui-btn-warm layui-btn-small"><span class="glyphicon glyphicon-pencil"></span> 编辑</button>
                <button id="btnDelete" class="layui-btn layui-btn-danger layui-btn-small"><span class="glyphicon glyphicon-trash"></span> 删除</button>
                <button id="btnPush" class="layui-btn layui-btn-normal layui-btn-small">  <span class="glyphicon glyphicon-pencil"></span>推送 </button>
                <button id="btnPushReview" class="layui-btn layui-btn-normal layui-btn-small">  <span class="glyphicon glyphicon-pencil"></span>推送并评议</button>
                <button id="btnSearchFull" class="layui-btn  layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-search"></span>查询</button>
                <button id="btnMessage" class="layui-btn layui-btn-orchid layui-btn-small"><span class="glyphicon glyphicon-list-alt"></span>详情</button>
                <button id="btnExport" class="layui-btn layui-btn-springgreen  layui-btn-small"><span class="glyphicon glyphicon-arrow-down"></span>导出</button>
                <button id="btnRefresh" class="layui-btn layui-btn-blue layui-btn-small"><span class="glyphicon glyphicon-repeat"></span>刷新</button>
            </div>
        </div>
        <div class="layui-tab-content" style="overflow-x: scroll; white-space: nowrap;">
            <table class="layui-table" lay-skin="line">
                <thead>
                    <tr>
                        <th hidden></th>
                        <th></th>
                        <th>受理单号</th>
                        <th>业主姓名</th>
                        <th>业主电话</th>
                        <th>业主身份证</th>
                        <th>租赁起始日期</th>
                        <th>租赁结束日期</th>
                        <th>税收起始日期</th>
                        <th>税收结束日期</th>
                        <th>税号</th>
                        <th>应纳税额(元)</th>
                        <th>面积</th>
                        <th>租金(元/月)</th>
                        <th>房屋产权</th>
                        <th>房屋属性</th>
                        <th>房屋类型</th>
                        <th>受理状态</th>

                    </tr>
                </thead>
                <tbody id="accordion">
                    @foreach (var item in Model.PageData)
                    {
                        <tr>
                            <td hidden>@item.Acceptance_Id</td>
                            <td><input type="radio" name="chk" id="@item.Acceptance_Id" value="@item.Acceptance_Id" /></td>
                            <td>@item.Acceptance_TicketNumber</td>
                            <td>@item.NatPer_Name</td>
                            <td>@item.NatPer_Phone</td>
                            <td>@item.NatPer_IDNumber</td>
                            @if (@item.Lease_StartTime != null)
                            {
                                 <td>@TimeHelper.TimeStampToDateTime(item.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                 <td></td>
                            }
                            @if (@item.Lease_EndTime != null)
                            {
                                <td>@TimeHelper.TimeStampToDateTime(item.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td></td>
                            }
                            @if (@item.Acceptance_TaxStartTime != null)
                            {
                               <td>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td></td>
                            }
                            @if (@item.Acceptance_TaxEndTime != null)
                            {
                                <td>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td></td>
                            }                           
                            <td>@item.Acceptance_TaxNumber</td>
                            <td>@(item.Tax*0.01)</td>
                            <td>@item.Hs_Proportion</td>
                            <td>@(item.LeaseRent*0.01)</td>
                            <td>@item.Csqx</td>
                            <td>@item.AHA</td>
                            <td>@item.HsFlage</td>
                            <td hidden>@item.Hs_Cqsx</td>
                            <td hidden>@item.Hs_attribute</td>
                            <td hidden>@item.Hs_Id</td>
                            <td hidden>@item.Hs_Number</td>
                            <td hidden>@item.Bd_Id</td>
                            <td hidden>@item.Bd_Name</td>
                            <td hidden>@item.Uim_Id</td>
                            <td hidden>@item.Uim_Name</td>
                            <td hidden>@item.Tenant_Id</td>
                            <td hidden>@item.Tenant_Name</td>
                            <td hidden>@item.Lease_Id</td>
                            <td hidden>@item.NatPer_Id</td>
                            <td hidden>@item.Acceptance_Address</td>
                            <td hidden>@item.Tenant_Type</td>
                            <td hidden>@item.Dt_Id</td>
                            <td hidden>@item.Acceptance_State</td>
                            @if (@item.State == "被退回")
                            {
                                <td style="color:red">@item.State</td>
                            }
                            else
                            {
                                <td>@item.State</td>
                            }
                            <td hidden>@item.Hs_Flage</td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="col-sm-12">
                <div class="col-sm-10">
                    @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
                </div>
                <div class="col-sm-2 to-righjt">
                    共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
                </div>
            </div>
        </div>
    </div>

    <!-- 新增编辑模态 -->
    <div id="myModal" hidden data-backdrop="static">
        <div id="divfrom" class="layui-tab-content">
            <form method="get" class="form-horizontal m-t">
                <div class="layui-form-item" hidden>
                    <label class="col-sm-2 layui-form-label">自然人Id：</label>
                    <div class="col-sm-10">
                        <input id="NatPer_Id" type="text" class="form-control">
                        <input id="Acceptance_Id" type="text" class="form-control">
                        <input id="Tenant_Id" type="text" class="form-control">
                        <input id="Hs_Id" type="text" class="form-control">
                        <input id="Bd_Id" type="text" class="form-control">
                        <input id="Uim_Id" type="text" class="form-control">
                        <input id="Lease_Id" type="text" class="form-control">
                        <input id="Acceptance_State" type="text" class="form-control">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">业主姓名：</label>
                    <div class="col-sm-4">
                        <input id="NatPer_Name" type="text" class="form-control" placeholder="请输入业主姓名" autofocus="autofocus" datacol="yes" err="业主姓名" checkexpession="NotNull">
                    </div>
                    <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                    <div class="col-sm-4">
                        <input id="NatPer_Phone" type="text" class="form-control" placeholder="请输入业主联系电话" autofocus="autofocus" datacol="yes" err="业主联系电话" checkexpession="MobileOrPhone">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label f12">业主身份证号：</label>
                    <div class="col-sm-4">
                        <input id="NatPer_IDNumber" type="text" class="form-control" placeholder="请输入业主身份证号" autofocus="autofocus" datacol="yes" err="业主身份证号" checkexpession="IDCard">
                    </div>
                    <label class="col-sm-2 layui-form-label">租户类别：</label>
                    <div class="col-sm-4">
                        <select name="temp" class="form-control" id="Tenant_Type">
                            <option value="1">个人</option>
                            <option value="2">企业</option>
                        </select>
                    </div>
                </div>

                <div class="hr-line-dashed"></div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                    <div class="col-sm-4">
                        <input id="Lease_StartTime" type="text" class="laydate-icon  form-control layer-date" placeholder="请选择租赁起始时间" autofocus="autofocus" datacol="yes" err="租赁起始时间" checkexpession="NotNull">
                    </div>
                    <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                    <div class="col-sm-4">
                        <input id="Lease_EndTime" type="text" class="laydate-icon form-control layer-date" placeholder="请选择租赁结束时间" autofocus="autofocus" datacol="yes" err="租赁结束时间" checkexpession="NotNull">
                    </div>

                </div>
                <div class="hr-line-dashed"></div>

                <div class="layui-form-item" id="TaxEndTime">
                    <label class="col-sm-2 layui-form-label">税收起始时间：</label>
                    <div class="col-sm-4">
                        <input id="Acceptance_TaxStartTime" name="Acceptance_TaxStartTime" type="text" class="laydate-icon  form-control layer-date" placeholder="请选择税收起始时间" autofocus="autofocus" datacol="yes" err="税收起始时间" checkexpession="NotNull">
                    </div>
                    <label class="col-sm-2 layui-form-label">税收结束时间：</label>
                    <div class="col-sm-4">
                        <input id="Acceptance_TaxEndTime" name="Acceptance_TaxEndTime" type="text" class="laydate-icon form-control layer-date" placeholder="请选择税收结束时间" autofocus="autofocus" datacol="yes" err="税收结束时间" checkexpession="NotNull">
                    </div>

                </div>
                <div class="hr-line-dashed"></div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">税号：</label>
                    <div class="col-sm-4">
                        <input id="Acceptance_TaxNumber" type="text" class="form-control" placeholder="请输入税号" autofocus="autofocus" datacol="yes" err="税号" checkexpession="NotNull">
                    </div>
                    <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                    <div class="col-sm-4">
                        <input id="Tenant_Name" type="text" class="form-control" placeholder="请输入付款人/单位" autofocus="autofocus" datacol="yes" err="付款人/单位" checkexpession="NotNull" onblur="addAcceptanceAddress()" >
                    </div>
                </div>
                <div class="hr-line-dashed"> </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">行政区：</label>
                    <div class="col-sm-4">
                        <select id="Region"  class="form-control" disabled>
                            <option value="" selected>西安市莲湖区</option>
                        </select>
                    </div>
                    <label class="col-sm-2 layui-form-label">街办：</label>
                    <div class="col-sm-4">
                        <select name="temp" class="form-control" id="Street" disabled=""></select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">房屋属性： </label>
                    <div class="col-sm-4">
                        <select name="temp" class="form-control" id="Hs_attribute">                         
                            <option value="1">住宅</option>
                            <option value="2">非住宅</option>
                        </select>
                    </div>
                    <label class="col-sm-2 layui-form-label">房屋类型： </label>
                    <div class="col-sm-4">
                        <select name="temp" class="form-control" id="Hs_Flage" onchange="SelectHousOrShop()">
                            <option value="2">房屋</option>
                            <option value="1">商铺</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">社区：</label>
                    <div class="col-sm-4">
                        <select name="temp" class="form-control" id="Dt_Id"></select>
                    </div>
                    <label class="col-sm-2 layui-form-label" id="lblBuldingName">楼宇名称：</label>
                    <div class="col-sm-4">
                        <input id="Bd_Name" type="text" class="form-control" value="" autofocus="autofocus"   datacol="yes"  checkexpession="NotNull">
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label" id="lblUimName">单元名称：</label>
                    <div class="col-sm-4">
                        <input id="Uim_Name" type="text" class="form-control" value=""  autofocus="autofocus" datacol="yes"  checkexpession="NotNull">
                    </div>
                    <label class="col-sm-2 layui-form-label" id="lblHouesName">房号：</label>
                    <div class="col-sm-4">
                        <input id="Hs_Number" type="text" class="form-control" value="" autofocus="autofocus">
                    </div>
                </div>        
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">房屋面积(㎡)：</label>
                    <div class="col-sm-4">
                        <input id="Hs_Proportion" type="text" class="form-control" placeholder="请输入房屋面积" autofocus="autofocus" datacol="yes" err="房屋面积" checkexpession="Double">
                    </div>
                    <label class="col-sm-2 layui-form-label">产权属性：  </label>
                    <div class="col-sm-4">
                        <select name="temp" class="form-control" id="Hs_Cqsx">
                            <option value="1" selected>个人</option>
                        </select>
                    </div>

                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">地址：</label>
                    <div class="col-sm-9">
                        <input id="Acceptance_Address" type="text" class="form-control" value="" autofocus="autofocus">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="col-sm-2 layui-form-label">租金（元/月）：</label>
                    <div class="col-sm-4">
                        <input id="Lease_Rent" type="text" class="form-control" placeholder="请输入租金" autofocus="autofocus" datacol="yes" err="租金" checkexpession="Negative">
                        <input id="Acceptance_PropertyTax" type="hidden" class="form-null"><!--房产税-->
                        <input id="Acceptance_PersonalTax" type="hidden" class="form-null"><!--个人所得税-->
                        <input id="Acceptance_Tax" type="hidden" class="form-null"><!--税金-->
                        <input id="Acceptance_TotalTax" type="hidden" class="form-null"><!--计税总额-->
                    </div>
                </div>
            </form>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <div class="col-sm-11 ">
                    <button id="btnSure" class="btn btn-info  pull-right">
                        <i class="fa fa-check"></i>提交
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- 推送并评议模态 -->
    <div id="myModalReview" hidden data-backdrop="static">
        <div class="layui-tab-content" style="overflow-y: auto;">
            <div id="divfrom" class="layui-tab-content">
                <form method="get" class="form-horizontal m-t">
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">业主姓名：</label>
                        <div class="col-sm-4">

                            <input id="NatPer_Names" type="text" class="form-control" readonly="readonly">
                        </div>
                        <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                        <div class="col-sm-4">
                            <input id="NatPer_Phones" type="text" class="form-control" readonly="readonly">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">业主身份证号：</label>
                        <div class="col-sm-4">
                            <input id="NatPer_IDNumbers" type="text" class="form-control" readonly="readonly">
                        </div>
                        <label class="col-sm-2 layui-form-label">税号：</label>
                        <div class="col-sm-4">
                            <input id="Acceptance_TaxNumbers" type="text" class="form-control" readonly="readonly">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                        <div class="col-sm-4">
                            <input id="Lease_StartTimes" type="text" class="laydate-icon  form-control layer-date" readonly="readonly">
                        </div>
                        <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                        <div class="col-sm-4">
                            <input id="Lease_EndTimes" type="text" class="laydate-icon form-control layer-date" readonly="readonly">
                        </div>
                    </div>

                    <div class="layui-form-item" id="TaxEndTime">
                        <label class="col-sm-2 layui-form-label">税收起始时间：</label>
                        <div class="col-sm-4">
                            <input id="Acceptance_TaxStartTimes" name="Acceptance_TaxStartTime" type="text" class="laydate-icon  form-control layer-date" readonly="readonly">
                        </div>
                        <label class="col-sm-2 layui-form-label">税收结束时间：</label>
                        <div class="col-sm-4">
                            <input id="Acceptance_TaxEndTimes" name="Acceptance_TaxEndTime" type="text" class="laydate-icon form-control layer-date" readonly="readonly">
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">租户类别：</label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Tenant_Types" disabled>
                                <option value="1">个人</option>
                                <option value="2">企业</option>
                            </select>

                        </div>
                        <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                        <div class="col-sm-4">
                            <input id="Tenant_Names" type="text" class="form-control" readonly="readonly">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">行政区：</label>
                        <div class="col-sm-4">
                            <select id="Regions" class="form-control" disabled>
                                <option>西安市莲湖区</option>
                            </select>
                        </div>
                        <label class="col-sm-2 layui-form-label">街办：</label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Streets" disabled></select>
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">社区：</label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Dt_Ids" disabled></select>
                        </div>
                        <label class="col-sm-2 layui-form-label" id="lblBulding">楼宇名称：</label>
                        <div class="col-sm-4">
                            <input id="Bd_Names" type="text" class="form-control" readonly="readonly">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label" id="lblUim">单元名称：</label>
                        <div class="col-sm-4">
                            <input id="Uim_Names" type="text" class="form-control" value="" readonly="readonly">
                        </div>
                        <label class="col-sm-2 layui-form-label" id="lblHouse">房号：</label>
                        <div class="col-sm-4">
                            <input id="Hs_Numbers" type="text" class="form-control" value="" readonly="readonly">
                        </div>
                    </div>


                    <div class="layui-form-item">

                        <label class="col-sm-2 layui-form-label">
                            <nobr>产权属性：</nobr>
                        </label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Hs_Cqsxs" disabled>
                                <option value="1">个人</option>
                                <option value="2">公用</option>
                            </select>
                        </div>
                        <label class="col-sm-2 layui-form-label">
                            <nobr>房屋属性：</nobr>
                        </label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Hs_attributes" disabled>
                                <option value="1">住宅</option>
                                <option value="2">非住宅</option>
                            </select>

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">房屋面积(㎡)：</label>
                        <div class="col-sm-4">
                            <input id="Hs_Proportions" type="text" class="form-control" readonly="readonly">
                        </div>
                        <label class="col-sm-2 layui-form-label">租金（元/月）：</label>
                        <div class="col-sm-4">
                            <input id="Lease_Rents" type="text" class="form-control">
                            <input id="Acceptance_PropertyTaxs" type="hidden" class="form-null"><!--房产税-->
                            <input id="Acceptance_PersonalTaxs" type="hidden" class="form-null"><!--个人所得税-->
                            <input id="Acceptance_Taxs" type="hidden" class="form-null"><!--税金-->
                            <input id="Acceptance_TotalTaxs" type="hidden" class="form-null"><!--计税总额-->

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">地址：</label>
                        <div class="col-sm-10">
                            <input id="Acceptance_Addresss" type="text" class="form-control" value="西安市莲湖区" readonly="readonly">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">评议意见：</label>
                        <div class="col-sm-10">
                            <textarea id="Review_Comment" rows="2" cols="20" class="form-control" autofocus="autofocus"></textarea>
                        </div>
                    </div>
                </form>
                <div class="box-footer">
                    <button type="submit" class="layui-btn layui-btn-normal layui-btn-small pull-right" id="btnReview">
                        <i class="fa fa-search"></i>推送
                    </button>
                </div>
            </div>
        </div>
     </div>

    <!-- 导出模态 -->
    <form action="/Base/ExportNaturalPerson" enctype="multipart/form-data" method="post" id="formDownload">
        <div id="exportHtml" style="display:none;">
            <div class="eh_wrap">
                <div class="eh_head">
                    <p style="">请选择您要导出的数据列</p>
                </div>
                <table width="100%" cellpadding="5" cellspacing="0">
                    <tr>
                        <td><input id="Acceptance_TicketNumber" type="checkbox" value="受理单号" name="chk_list" checked="checked" /><label>受理单号</label></td>
                        <td><input id="NatPer_Name" type="checkbox" value="业主姓名" name="chk_list" checked="checked" /><label>业主姓名</label></td>
                        <td><input id="NatPer_Phone" type="checkbox" value="业主电话" name="chk_list" checked="checked" /><label>业主电话</label></td>
                        <td><input id="NatPer_IDNumber" type="checkbox" value="业主身份证" name="chk_list" checked="checked" /><label>业主身份证</label></td>
                    </tr>
                    <tr>
                        <td><input id="Lease_StartTime" type="checkbox" value="租赁起始日期" name="chk_list" checked="checked" /><label>租赁起始日期</label></td>
                        <td><input id="Lease_EndTime" type="checkbox" value="租赁结束日期" name="chk_list" checked="checked" /><label>租赁结束日期</label></td>
                        <td><input id="Acceptance_TaxStartTime" type="checkbox" value="税收起始日期" name="chk_list" checked="checked" /><label>税收起始日期</label></td>
                        <td><input id="Acceptance_TaxEndTime" type="checkbox" value="税收结束日期" name="chk_list" checked="checked" /><label>税收结束日期</label></td>
                    </tr>
                    <tr>
                        <td><input id="Acceptance_TaxNumber" type="checkbox" value="税号" name="chk_list" checked="checked" /><label>税号</label></td>
                        <td><input id="Tax" type="checkbox" value="税金" name="chk_list" checked="checked" /><label>税金（元）</label></td>
                        <td><input id="Hs_Proportion" type="checkbox" value="面积" name="chk_list" checked="checked" /><label>面积(平米)</label></td>
                        <td><input id="LeaseRent" type="checkbox" value="租金" name="chk_list" checked="checked" /><label>租金（元）</label></td>
                    </tr>
                    <tr>
                        <td><input id="Csqx" type="checkbox" value="产权属性" name="chk_list" checked="checked" /><label>产权属性</label></td>
                        <td><input id="AHA" type="checkbox" value="房屋属性" name="chk_list" checked="checked" /><label>房屋属性</label></td>
                        <td><input id="State" type="checkbox" value="受理状态" name="chk_list" checked="checked" /><label>受理状态</label></td>
                    </tr>
                </table>
                <div class="box-footer">
                    <button type="submit" id="btnExportSure" class="btn btn-info pull-right">
                        <i class="fa fa-repeat"></i>导出
                    </button>
                    <input type="hidden" id="fields" name="fields" value="" />
                    <input type="hidden" id="where" name="where" value="" />
                </div>
            </div>
        </div>
    </form>

    <!-- 详情模态 -->
    <div id="myModalDetails" hidden data-backdrop="static">
        <div id="divfrom" class="layui-tab-content">
            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">业主姓名：</label>
                <div class="col-sm-4 layui-input" id="NatPer_NameD"></div>
                <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                <div class="col-sm-4 layui-input" id="NatPer_PhoneD"></div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label f12">业主身份证号：</label>
                <div class="col-sm-4 layui-input" id="NatPer_IDNumberD"> </div>
                <label class="col-sm-2 layui-form-label">税号：</label>
                <div class="col-sm-4 layui-input" id="Acceptance_TaxNumberD"></div>
            </div>
            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                <div class="col-sm-4 layui-input" id="Lease_StartTimeD"></div>
                <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                <div class="col-sm-4 layui-input" id="Lease_EndTimeD"></div>
            </div>

            <div class="layui-form-item" id="TaxEndTime">
                <label class="col-sm-2 layui-form-label">税收起始时间：</label>
                <div class="col-sm-4 layui-input" id="Acceptance_TaxStartTimeD"></div>
                <label class="col-sm-2 layui-form-label">税收结束时间：</label>
                <div class="col-sm-4 layui-input" id="Acceptance_TaxEndTimeD"></div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">租户类别：</label>
                <div class="col-sm-4">
                    <select name="temp" class="form-control" id="Tenant_TypeD" disabled>
                        <option value="1">个人</option>
                        <option value="2">企业</option>
                    </select>
                </div>
                <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                <div class="col-sm-4 layui-input" id="Tenant_NameD"></div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">行政区：</label>
                <div class="col-sm-4 layui-input" id="RegionD">西安市莲湖区 </div>
                <label class="col-sm-2 layui-form-label">街办：</label>
                <div class="col-sm-4">
                    <select name="temp" class="form-control" id="StreetD" disabled></select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">社区：</label>
                <div class="col-sm-4">
                    <select name="temp" class="form-control" id="Dt_IdD" disabled></select>
                </div>
                <label class="col-sm-2 layui-form-label" id="lblBulding1">楼宇名称：</label>
                <div class="col-sm-4 layui-input" id="Bd_NameD"></div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label" id="lblUim1">单元名称：</label>
                <div class="col-sm-4 layui-input" id="Uim_NameD"></div>
                <label class="col-sm-2 layui-form-label" id="lblHouse1">房号：</label>
                <div class="col-sm-4 layui-input" id="Hs_NumberD"> </div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">
                    <nobr>产权属性：</nobr>
                </label>
                <div class="col-sm-4">
                    <select name="temp" class="form-control" id="Hs_CqsxD" disabled>
                        <option value="1">个人</option>
                        <option value="2">公用</option>
                    </select>
                </div>
                <label class="col-sm-2 layui-form-label">
                    <nobr>房屋属性：</nobr>
                </label>
                <div class="col-sm-4">
                    <select name="temp" class="form-control" id="Hs_attributeD" disabled>
                        <option value="1">住宅</option>
                        <option value="2">非住宅</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">房屋面积(㎡)：</label>
                <div class="col-sm-4 layui-input" id="Hs_ProportionD"> </div>
                <label class="col-sm-2 layui-form-label">租金（元/月）：</label>
                <div class="col-sm-4 layui-input" id="Lease_RentD"> </div>
            </div>

            <div class="layui-form-item">
                <label class="col-sm-2 layui-form-label">地址：</label>
                <div class="col-sm-10 layui-input" id="Acceptance_AddressD"></div>
            </div>


        </div>
    </div>


    <!--查询-->
    @using (Html.BeginForm("Zor_NaturalPerson", "Base", new RouteValueDictionary { { "Model", Model } }, FormMethod.Get))
    {
        <!-- 查询模态框 -->
    <div id="myModalSearch" hidden data-backdrop="static">
        <div id="divfrom" class="layui-tab-content">
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                        <div class="col-sm-4">
                            <input id="Search_StartTime" name="Lease_StartTime" type="text" class="laydate-icon  form-control layer-date" value="@Model.Lease_StartTime">
                        </div>
                        <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                        <div class="col-sm-4">
                            <input id="Search_EndTime" name="Lease_EndTime" type="text" class="laydate-icon form-control layer-date" value="@Model.Lease_EndTime">
                        </div>

                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">业主姓名：</label>
                        <div class="col-sm-4">
                            <input name="NatPer_Name" type="text" class="form-control" value="@Model.NatPer_Name">
                        </div>
                        <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                        <div class="col-sm-4">
                            <input name="NatPer_Phone" type="text" class="form-control" value="@Model.NatPer_Phone">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label f12">业主身份证号：</label>
                        <div class="col-sm-4">
                            <input name="NatPer_IDNumber" type="text" class="form-control" value="@Model.NatPer_IDNumber">
                        </div>
                        <label class="col-sm-2 layui-form-label">税号：</label>
                        <div class="col-sm-4">
                            <input name="Acceptance_TaxNumber" type="text" class="form-control" value="@Model.Acceptance_TaxNumber">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                        <div class="col-sm-4">
                            <input name="Tenant_Name" type="text" class="form-control" value="@Model.Tenant_Name">
                        </div>
                        <label class="col-sm-2 layui-form-label">受理单号：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="Acceptance_TicketNumber" value="@Model.Acceptance_TicketNumber">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">受理单状态：</label>

                        <div class="col-sm-4">
                            <select class="form-control" name="State">
                                <option value="全部" selected>全部</option>
                                <option value="@Model.State">已保存</option>
                                <option value="@Model.State">已提交</option>
                                <option value="@Model.State">被退回</option>
                                <option value="@Model.State">已评议</option>
                                <option value="@Model.State">已评定</option>
                                <option value="@Model.State">已审核</option>
                                <option value="@Model.State">已缴税</option>
                                <option value="@Model.State">已开票</option>
                                <option value="@Model.State">已销号</option>
                                <option value="@Model.State">已汇总</option>
                            </select>
                        </div>
                        <label class="col-sm-2 layui-form-label">发起类型：</label>
                        <div class="col-sm-4">
                            <select name="AcceptanceType" class="form-control">
                                <option value="全部">全部</option>
                                <option value="@Model.AcceptanceType">社区</option>
                                <option value="@Model.AcceptanceType">自然人</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="box-footer">
                    <button type="submit" class="btn btn-info pull-right">
                        <i class="fa fa-search"></i>查询
                    </button>
                </div>
        </div>

    }
    <script type="text/javascript">

        //自动添加地址
        function addAcceptanceAddress()
        {
            //获取业主姓名
            var NatPerName = $("#NatPer_Name").val();
            //获取付款人/单位姓名
            var TenantName = $("#Tenant_Name").val();
            var Address = "西安市莲湖区";

            if (NatPerName != null && TenantName != null) {
                getAjax("/Base/GetAcceptanceAddress", { "NatPer_Name": NatPerName, "Tenant_Name": TenantName }, function (data) {
                    var accordionJson = eval("(" + data + ")");
                    $("#Acceptance_Address").val(accordionJson[0]);
                });
            }
            else
            {
                $("#Acceptance_Address").val(Address);
            }
        }

        //选择商铺或房屋  改变标签的内容
        function SelectHousOrShop()
        {
            var HsFlage = $("#Hs_Flage").val();
            if (HsFlage == 1)
            {
                //设置商铺标签
                $("#lblBuldingName").html("街道名称：");
                $("#lblUimName").html("门牌号:");
                $("#lblHouesName").html("商铺编号:");
            }
            else
            {
                //设置房屋标签
                $("#lblBuldingName").html("楼宇名称：");
                $("#lblUimName").html("单元名称:");
                $("#lblHouesName").html("房号:");
            }
        }



        /**
        *   日期选择器
        */
        laydate.skin('molv');         //日历皮肤
        var start = {                   //开始时间选择
            elem: "#Lease_StartTime",
            format: "YYYY-MM-DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: true,
            istoday: true,
            choose: function (datas) {
                end.min = datas;
                end.start = datas;
                $("input[name='Acceptance_TaxStartTime']").val(datas)//税收起始、结束时间获得焦点时获取租赁起始、结束时间
            }
        };
        var end = {                     //结束时间选择
            elem: "#Lease_EndTime",
            format: "YYYY-MM-DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: true,
            istoday: true,
            choose: function (datas) { start.max = datas; $("input[name='Acceptance_TaxEndTime']").val(datas) }
        };
        var taxstart = {                   //开始时间选择
            elem: "#Acceptance_TaxStartTime",
            format: "YYYY-MM-DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: true,
            istoday: true,
            choose: function (datas) {
                end.min = datas;
                end.start = datas
            }
        };
        var taxend = {                     //结束时间选择
            elem: "#Acceptance_TaxEndTime",
            format: "YYYY-MM-DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: true,
            istoday: true,
            choose: function (datas) { start.max = datas }
        };
        laydate(start);
        laydate(end);
        laydate(taxstart);
        laydate(taxend);
        /**
    *   日期选择器---查询租赁日期
    */
        laydate.skin('molv');         //日历皮肤
        var startS = {                   //开始时间选择
            elem: "#Search_StartTime",
            format: "YYYY/MM/DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: false,
            istoday: true,
            choose: function (datas) {
                end.min = datas;
                end.start = datas
            }
        };
        var endS = {                     //结束时间选择
            elem: "#Search_EndTime",
            format: "YYYY/MM/DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: false,
            istoday: true,
            choose: function (datas) { start.max = datas }
        };
        laydate(startS);
        laydate(endS);

    </script>
    <script type="text/javascript">

        $(function () {

            /*全选*/
            $("#cbkCheckAll").click(function () {
                if (this.checked) {
                    $("input[name='chk']").prop('checked', true);
                } else {
                    $("input[name='chk']").prop('checked', false);
                }
            });

            /*查询*/

            $("#btnSearchFull").click(function () {
                LayerOpen('800px', '350px', '查询', $('#myModalSearch'));
            });

            /*刷新*/
            $("#btnRefresh").click(function () {
                Replace();
            });

            /*增加*/
            $("#btnAdd").click(function () {
                ClearWebControls(divfrom);
                GetStreet(); //所属街道  
                $("#Acceptance_Address").val("西安市莲湖区");
                LayerOpen('900px', '625px', '自然人新增', $('#myModal'));
            });

            /*保存*/
            $("#btnSure").click(function () {

                if (!CheckDataValid('.form-horizontal')) {
                    return false;
                }

                //var re = /^[0-9]+.?[0-9]*$/;
                var LeaseRent = $("#Lease_Rent").val(); //获取输入的租金
                if (LeaseRent == "") {
                    layer.msg("请输租金!", 0);
                    return;
                }
                if (!LeaseRent.match(/^\d+(\.\d{2})?$/)) {
                    layer.msg("租金输入有误,请输入到小数点后面两位！", 0);
                    return;
                }
                if (LeaseRent == 0) {
                    layer.msg("租金输入有误,租金不能为0元", 0);
                    return;
                }

                if (!checkEndTime($("#Lease_StartTime").val(), $("#Acceptance_TaxStartTime").val())) {
                    layer.msg("税收起始时间必须晚于租赁起始时间！");
                    return;
                }
                if ($("#Acceptance_State").val() != 2 && $("#Acceptance_State").val() != 0 && $("#Acceptance_State").val() != null && $("#Acceptance_State").val() != "") {
                    layer.msg("当前受理单已提交上级，不能修改！");
                    return;
                }

                //计算房产税、个税
                var bgDate = $("#Acceptance_TaxStartTime").val();
                var endDate = $("#Acceptance_TaxEndTime").val(); //获取税收开始时间、结束时间
                var rentMoney = $("#Lease_Rent").val();   //租金
                var type = $("#Hs_attribute").val();

             


                /*计算个人税、房产税、税金*/
                getRatMoney(bgDate, endDate, rentMoney, type);
                var propertytax = fcRat.toFixed(2) * 100; //房产税
                var personaltax = GrRat.toFixed(2) * 100;//个人所得税
                var tax = jszje.toFixed(2) * 100;//税金 = 房产税+个人所得税


                //添加模态框隐藏域赋值
                $("#Acceptance_PropertyTax").val(propertytax);                             
                $("#Acceptance_PersonalTax").val(personaltax);               
                $("#Acceptance_Tax").val(tax);           
                $("#Acceptance_TotalTax").val(totalRent.toFixed(2) * 100);
             

              

                var JsData = GetWebControls(divfrom);
                var lease_starttime = $("#Lease_StartTime").val();
                var lease_endtime = $("#Lease_EndTime").val();
                ZorPostSimpleData("/Base/AddAlterNaturalPerson", JSON.stringify({ "naturalPerson": JsData, "lease": JsData, "acceptance": JsData, "tenant": JsData, "house": JsData, "unitInfo": JsData, "Build": JsData, "leasestartTime": lease_starttime, "leaseendTime": lease_endtime, "taxstarttime": bgDate, "taxendtime": endDate }), function (data) {
                    layer.msg(data.AnswerMeg, function () {
                        layer.closeAll();
                        Replace();
                    });
                });

            });

            /*修改受理单*/
            $("#btnUpdate").click(function () {
                var checkId = CheckboxValueIDs();
                if (checkId.length == 0) {
                    layer.msg("请选择要修改的信息！");
                    return;
                }
                if (checkId.length > 1) {
                    layer.msg("仅可选择一行信息修改！");
                    return;
                }

                var HsFlage = getTableCell(34);             
                if (HsFlage == 1) {
                    //设置商铺标签
                    $("#lblBuldingName").html("街道名称：");
                    $("#lblUimName").html("门牌号:");
                    $("#lblHouesName").html("商铺编号:");
                }
                else {
                    //设置房屋标签
                    $("#lblBuldingName").html("楼宇名称：");
                    $("#lblUimName").html("单元名称:");
                    $("#lblHouesName").html("房号:");
                }

                $("#Acceptance_Id").val(getTableCell(0));
                $("#Acceptance_TicketNumber").val(getTableCell(2));
                $("#NatPer_Name").val(getTableCell(3));
                $("#NatPer_Phone").val(getTableCell(4));
                $("#NatPer_IDNumber").val(getTableCell(5));
                $("#Lease_StartTime").val(getTableCell(6));
                $("#Lease_EndTime").val(getTableCell(7));
                $("#Acceptance_TaxStartTime").val(getTableCell(8));
                $("#Acceptance_TaxEndTime").val(getTableCell(9));
                $("#Acceptance_TaxNumber").val(getTableCell(10));
                $("#Acceptance_Tax").val(getTableCell(11));
                $("#Hs_Proportion").val(getTableCell(12));
                $("#Lease_Rent").val(getTableCell(13));
                $("#Hs_Cqsx").val(getTableCell(17));
                $("#Hs_attribute").val(getTableCell(18));
                $("#Hs_Id").val(getTableCell(19));
                $("#Hs_Number").val(getTableCell(20));
                $("#Bd_Id").val(getTableCell(21));
                $("#Bd_Name").val(getTableCell(22));
                $("#Uim_Id").val(getTableCell(23));
                $("#Uim_Name").val(getTableCell(24));
                $("#Tenant_Id").val(getTableCell(25));
                $("#Tenant_Name").val(getTableCell(26));
                $("#Lease_Id").val(getTableCell(27));
                $("#NatPer_Id").val(getTableCell(28));
                $("#Acceptance_Address").val(getTableCell(29));
                $("#Tenant_Type").val(getTableCell(30));
                $("#Dt_Id").val(getTableCell(31));
                $("#Acceptance_State").val(getTableCell(32));
                $("#Hs_Flage").val(getTableCell(34));
                var Dt_Id = getTableCell(31);    //获取社区ID
                getAjax("/Base/SelectStreetByDtId", { "dt_Id": Dt_Id }, function (data) {

                    GetStreet(); //初始化所属街道
                    $("#Street").val(data);//设置选中街道
                    GetCommunity($("#Street").val());//获取社区
                    $("#Dt_Id").val(Dt_Id);//设置选中社区
                });
                LayerOpen('900px', '625px', '自然人编辑', $('#myModal'));
            });

            /*详情*/
            $("#btnMessage").click(function () {
                var checkId = CheckboxValueIDs();
                $("#lbltitle").text("自然人详情");
                if (checkId.length == 0) {
                    layer.msg("请选择要查看的信息！");
                    $("#myModalDetails").attr("ID", "test");
                    return;
                }
                if (checkId.length > 1) {
                    layer.msg("仅可选择一行信息查看！");
                    $("#myModalDetails").attr("ID", "test");
                    return;
                }

                var HsFlage = getTableCell(34);
                if (HsFlage == 1) {
                    //设置商铺标签
                    $("#lblBulding1").html("街道名称：");
                    $("#lblUim1").html("门牌号:");
                    $("#lblHouse1").html("商铺编号:");
                }
                else {
                    //设置房屋标签
                    $("#lblBulding1").html("楼宇名称：");
                    $("#lblUim1").html("单元名称:");
                    $("#lblHouse1").html("房号:");
                }

                $("#test").attr("ID", "myModalDetails");
                $("#Acceptance_TicketNumberD").html(getTableCell(2));
                $("#NatPer_NameD").html(getTableCell(3));
                $("#NatPer_PhoneD").html(getTableCell(4));
                $("#NatPer_IDNumberD").html(getTableCell(5));
                $("#Lease_StartTimeD").html(getTableCell(6));
                $("#Lease_EndTimeD").html(getTableCell(7));
                $("#Acceptance_TaxStartTimeD").html(getTableCell(8));
                $("#Acceptance_TaxEndTimeD").html(getTableCell(9));
                $("#Acceptance_TaxNumberD").html(getTableCell(10));
                $("#Acceptance_TaxD").html(getTableCell(11));
                $("#Hs_ProportionD").html(getTableCell(12));
                $("#Lease_RentD").html(getTableCell(13));
                $("#Hs_CqsxD").val(getTableCell(17));
                $("#Hs_attributeD").val(getTableCell(18));
                $("#Hs_IdD").html(getTableCell(19));
                $("#Hs_NumberD").html(getTableCell(20));
                $("#Bd_IdD").html(getTableCell(21));
                $("#Bd_NameD").html(getTableCell(22));
                $("#Uim_IdD").html(getTableCell(23));
                $("#Uim_NameD").html(getTableCell(24));
                $("#Tenant_IdD").html(getTableCell(25));
                $("#Tenant_NameD").html(getTableCell(26));
                $("#Lease_IdD").html(getTableCell(27));
                $("#NatPer_IdD").html(getTableCell(28));
                $("#Acceptance_AddressD").html(getTableCell(29));
                $("#Tenant_TypeD").val(getTableCell(30));
                $("#Dt_IdD").val(getTableCell(31));
                $("#Acceptance_StateD").val(getTableCell(32));
                var Dt_Id = getTableCell(31);    //获取社区ID
                getAjax("/Base/SelectStreetByDtId", { "dt_Id": Dt_Id }, function (data) {
                    //初始化所属街道
                    var html = "";
                    getAjax("/Base/SelectStreet", "", function (data) {
                        accordionJson = eval("(" + data + ")");
                        $.each(accordionJson, function (i) {
                            $("#StreetD").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");//初始化街道
                        });
                    });
                    $("#StreetD").val(data);//设置选中街道
                    $("#Dt_IdD").empty();
                    getAjax("/Base/SelectCommunity", { "parentid": $("#StreetD").val() }, function (data) {
                        accordionJson = eval("(" + data + ")");
                        $.each(accordionJson, function (i) {
                            $("#Dt_IdD").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");
                        });
                    });
                    $("#Dt_IdD").val(Dt_Id);//设置选中社区
                    LayerOpen('900px', '550px', '自然人详情', $('#myModalDetails'));
                });
            });

            /*推送并评议*/
            $("#btnPushReview").click(function () {
                var checkId = CheckboxValueIDs();
                if (checkId.length == 0) {
                    layer.msg("请选择要推送并评议的信息！");
                    return;
                }
                if (checkId.length > 1) {
                    layer.msg("仅可选择一行信息推送并评议！");
                    $("#myModalReview").attr("ID", "test");
                    return;
                }

                //加载标签内容
                var HsFlage = getTableCell(34);
                if (HsFlage == 1) {
                    //设置商铺标签
                    $("#lblBulding").html("街道名称：");
                    $("#lblUim").html("门牌号:");
                    $("#lblHouse").html("商铺编号:");
                }
                else {
                    //设置房屋标签
                    $("#lblBulding").html("楼宇名称：");
                    $("#lblUim").html("单元名称:");
                    $("#lblHouse").html("房号:");
                }

                $("#test").attr("ID", "");
                $("#Acceptance_Id").val(getTableCell(0));
                $("#Acceptance_TicketNumbers").val(getTableCell(2));
                $("#NatPer_Names").val(getTableCell(3));
                $("#NatPer_Phones").val(getTableCell(4));
                $("#NatPer_IDNumbers").val(getTableCell(5));
                $("#Lease_StartTimes").val(getTableCell(6));
                $("#Lease_EndTimes").val(getTableCell(7));
                $("#Acceptance_TaxStartTimes").val(getTableCell(8));
                $("#Acceptance_TaxEndTimes").val(getTableCell(9));
                $("#Acceptance_TaxNumbers").val(getTableCell(10));
                $("#Acceptance_Taxs").val(getTableCell(11));
                $("#Hs_Proportions").val(getTableCell(12));
                $("#Lease_Rents").val(getTableCell(13));
                $("#Hs_Cqsxs").val(getTableCell(17));
                $("#Hs_attributes").val(getTableCell(18));
                $("#Hs_Numbers").val(getTableCell(20));
                $("#Bd_Names").val(getTableCell(22));
                $("#Uim_Names").val(getTableCell(24));
                $("#Tenant_Names").val(getTableCell(26));
                $("#Acceptance_Addresss").val(getTableCell(29));
                $("#Tenant_Types").val(getTableCell(30));
                $("#Dt_Ids").val(getTableCell(31));
                var Dt_Id = getTableCell(31);    //获取社区ID
                getAjax("/Base/SelectStreetByDtId", { "dt_Id": Dt_Id }, function (data) {
                    //初始化所属街道
                    var html = "";
                    getAjax("/Base/SelectStreet", "", function (data) {
                        accordionJson = eval("(" + data + ")");
                        $.each(accordionJson, function (i) {
                            $("#Streets").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");//初始化街道
                        });
                    });
                    $("#Streets").val(data);//设置选中街道
                    $("#Dt_Ids").empty();
                    getAjax("/Base/SelectCommunity", { "parentid": $("#Streets").val() }, function (data) {
                        accordionJson = eval("(" + data + ")");
                        $.each(accordionJson, function (i) {
                            $("#Dt_Ids").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");
                        });
                    });
                    $("#Dt_Ids").val(Dt_Id);//设置选中社区
                    LayerOpen('900px', '665px', '推送并评议', $('#myModalReview'));
                });

            });

            /*确定自然人推送并评议*/
            $("#btnReview").click(function () {
                var acceptancestate = getTableCell(32);
                if ($("#Review_Comment").val() == "") {
                    layer.msg("评议意见不能为空", 0);
                    return;
                }
                if (acceptancestate != 0 && acceptancestate != 2) {
                    layer.msg("不能重复推送！"); //未选中任何行
                    return;
                }
                //计算房产税、个税
                var bgDate = getTableCell(8);
                var endDate = getTableCell(9);
              
                var rentMoney = $("#Lease_Rents").val();
                var type = getTableCell(18);
                getRatMoney(bgDate, endDate, rentMoney, type);

                var ApeId = getTableCell(0);
                var propertytax = fcRat.toFixed(2) * 100; //房产税
                var personaltax = GrRat.toFixed(2) * 100;  //个人所得税
                var tax = jszje.toFixed(2) * 100; //税金


                var totaltax = totalRent.toFixed(2) * 100;  //计税总额
                var reviewcomment = $("#Review_Comment").val();
                var leaserent = rentMoney * 100;

                var dtid = getTableCell(31);//社区id
           
                ZorPostSimpleData("/Base/PushReview", JSON.stringify({ "ApeId": ApeId, "propertytax": propertytax, "tax": tax, "totaltax": totaltax, "personaltax": personaltax, "rentMoney": leaserent, "reviewcomment": reviewcomment, "acceptancestate": acceptancestate, "dtid": dtid }), function (data) {
                    layer.msg(data.AnswerMeg, function () {
                        layer.closeAll();
                        Replace();
                    });
                });

            });
            /*删除受理单*/
            $("#btnDelete").click(function () {
                var checkId = CheckboxValueIDs();  //获取受理单ID
                var LeaseId = getTableCell(27); //获取租赁关系表ID
                var HsId =getTableCell(19);  //获取房屋ID
                var BdId = getTableCell(21);   //获取楼宇ID
                var UimId = getTableCell(23); //获取单元ID
                var Hs_Flage = getTableCell(34); //房屋属性

                if (checkId.length == 0) {
                    layer.msg("请选择要删除受理单！"); //未选中任何行
                    return;
                }
                if (checkId.length > 1) {
                    layer.msg("仅可选择一行信息删除！");
                    return;
                }
                else {
                    layer.confirm("确定要删除吗?", { icon: 2, btn: ['确定', '取消'] }, function () {
                        ZorPostSimpleData("/Base/DeleteNaturalPerson", JSON.stringify({ "AcceptanceId": checkId[0], "Lease_Id": LeaseId, "Hs_Id": HsId, "Uim_Id": UimId, "Bd_Id": BdId, "Hs_attributes": Hs_Flage }), function (data) { //获取数据(带参数)
                            layer.msg(data.AnswerMeg, function () {
                                layer.closeAll();
                                Replace();
                            });
                        })
                    })
                }
            });

            /*自然人推送*/
            $("#btnPush").click(function () {
                var checkId = CheckboxValueIDs();
                var acceptancestate = getTableCell(32);
                if (checkId.length == 0) {
                    layer.msg("请选择要推送的受理单！"); //未选中任何行
                    return;
                }
                if (checkId.length > 1) {
                    layer.msg("请选择一条记录推送！");
                    return;
                }
                if (acceptancestate != 0 && acceptancestate != 2) {
                    layer.msg("不能重复推送！"); //未选中任何行
                    return;
                }
                else {

                    var dtid = getTableCell(31);//社区id
                    layer.confirm("确定要推送吗?", { icon: 2, btn: ['确定', '取消'] }, function () {
                        ZorPostSimpleData("/Base/Push", JSON.stringify({ 'Id': checkId[0], 'acceptancestate': acceptancestate, "dtid": dtid }), function (data) { //获取数据(带参数)
                            layer.msg(data.AnswerMeg, function () {
                                layer.closeAll();
                                Replace();
                            });
                        })
                    })
                }
            });
            /*导出*/
            $("#btnExport").click(function () {
                layer.open({
                    type: 1,
                    title: '导出提示',
                    shade: false,
                    skin: 'layui-layer-rim',
                    area: ['620px', '280px'], //宽高
                    content: $('#exportHtml')
                });
            });
            /*导出交互*/
            $("#btnExportSure").click(function () {
                var arr = new Array();
                $("[name='chk_list']").each(function () {
                    if ($(this).is(":checked")) {
                        arr.push($(this).attr("id") + "|" + $(this).val());
                    }
                });
                $("#fields").val(arr);
                document.getElementById('formDownload').submit();
                layer.closeAll();
            });
        });

        /**
        * 查询属社区
        */
        function GetCommunity(sid) {
            $("#Dt_Id").empty();
            getAjax("/Base/SelectCommunity", { "parentid": sid }, function (data) {
                accordionJson = eval("(" + data + ")");
                $.each(accordionJson, function (i) {
                    $("#Dt_Id").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");
                });
            });

        }
        /**
        * 查询属街道
        */
        function GetStreet() {

            var html = "";
            getAjax("/Base/SelectStreetById", "", function (data) {
                accordionJson = eval("(" + data + ")");
                $.each(accordionJson, function (i) {
                    $("#Street").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");//初始化街道
                });
            });
            GetCommunity($("#Street").val());//初始化社区

            /*注册街道下拉框事件 */
            $('#Street').change(function () {
                GetCommunity($(this).val());
            });
        }
        /**
     * 查询属社区
     */
        function GetCommunity(sid) {
            $("#Dt_Id").empty();
            getAjax("/Base/SelectCommunity", { "parentid": sid }, function (data) {
                accordionJson = eval("(" + data + ")");
                $.each(accordionJson, function (i) {
                    $("#Dt_Id").append("<option value='" + accordionJson[i].Dt_Id + "' >" + accordionJson[i].Dt_Name + "</option>");
                });
            });

        }

        function checkEndTime(startTime, endTime) {
            var start = new Date(startTime.replace("-", "/").replace("-", "/"));
            var end = new Date(endTime.replace("-", "/").replace("-", "/"));
            if (end < start) {
                return false;
            }
            return true;
        }
    </script>
</body>

</html>

